<?php

namespace App\Constants;

/**
 * 员工状态枚举
 */
class EmployeeStatusEnum extends AbstractEnum
{
    // 在职状态
    public const PROBATION = 'probation';
    public const REGULAR = 'regular';
    public const PROBATION_LEADER = 'probation_leader';
    
    // 离职状态
    public const RESIGNED = 'resigned';
    public const RETIRED = 'retired';
    public const DEATH = 'death';
    
    // 特殊状态
    public const SUSPENDED = 'suspended';
    public const LONG_LEAVE = 'long_leave';

    /**
     * 获取所有枚举实例
     */
    public static function getAll(): array
    {
        return [
            new self('probation', '试用期', '新员工试用期', '#FFA500', 'clock', 1),
            new self('regular', '正式员工', '正式在职员工', '#28A745', 'user-check', 2),
            new self('probation_leader', '试岗期', '领导岗位试岗期', '#FFC107', 'star', 3),
            new self('resigned', '已离职', '员工已离职', '#DC3545', 'user-times', 4),
            new self('retired', '已退休', '员工已退休', '#6C757D', 'user-clock', 5),
            new self('death', '工亡', '工伤死亡', '#000000', 'skull', 6),
            new self('suspended', '停职', '员工暂时停职', '#FD7E14', 'pause-circle', 7),
            new self('long_leave', '长期请假', '员工长期请假', '#E83E8C', 'calendar-minus', 8),
        ];
    }

    /**
     * 获取在职状态列表
     */
    public static function getActiveStatuses(): array
    {
        return [
            self::PROBATION,
            self::REGULAR,
            self::PROBATION_LEADER,
        ];
    }

    /**
     * 获取离职状态列表
     */
    public static function getInactiveStatuses(): array
    {
        return [
            self::RESIGNED,
            self::RETIRED,
            self::DEATH,
        ];
    }

    /**
     * 检查是否为在职状态
     */
    public static function isActive(string $status): bool
    {
        $activeStatuses = self::getActiveStatuses();
        return in_array($status, $activeStatuses);
    }

    /**
     * 检查是否为离职状态
     */
    public static function isInactive(string $status): bool
    {
        return !self::isActive($status);
    }
}
